package com.inmobi.commons.uid;

import android.content.Context;
import com.inmobi.commons.internal.InternalSDKUtil;
import org.json.JSONException;
import org.json.JSONObject;

public class UID
{
  public static final boolean FBA_DEF = false;
  public static final boolean LID_DEF = true;
  public static final boolean O1_DEF = true;
  public static final boolean SID_DEF = true;
  public static final boolean UM5_DEF = true;
  public static UID commons = new UID();
  boolean a = true;
  boolean b = true;
  boolean c = true;
  boolean d = false;
  boolean e = true;

  public UID()
  {
    setFromJSON(new JSONObject());
  }

  public UID(Context paramContext)
  {
    InternalSDKUtil.setContext(paramContext);
  }

  public UID(Context paramContext, JSONObject paramJSONObject)
  {
    this(paramContext);
    setFromJSON(paramJSONObject);
  }

  public UID(JSONObject paramJSONObject)
  {
    setFromJSON(paramJSONObject);
  }

  public String getUidMap(String paramString1, String paramString2, int paramInt, String paramString3)
  {
    try
    {
      InternalSDKUtil.initialize(InternalSDKUtil.getContext());
      label6: return getUidMapNoReinit(paramString1, paramString2, paramInt, paramString3);
    }
    catch (Exception localException)
    {
      break label6;
    }
  }

  public String getUidMapNoReinit(String paramString1, String paramString2, int paramInt, String paramString3)
  {
    Context localContext = InternalSDKUtil.getContext();
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("{");
    int i = 0;
    if (paramString1 != null)
    {
      boolean bool1 = this.c;
      i = 0;
      if (bool1)
      {
        boolean bool2 = commons.c;
        i = 0;
        if (bool2)
        {
          String str10 = UIDHelper.a(paramString1, paramString3);
          localStringBuilder.append("LID:'");
          localStringBuilder.append(str10);
          localStringBuilder.append("'");
          i = 1;
        }
      }
    }
    if ((paramString2 != null) && (this.b) && (commons.b))
    {
      if (i == 1)
        localStringBuilder.append(",");
      String str9 = UIDHelper.a(paramString2, paramString3);
      localStringBuilder.append("SID:'");
      localStringBuilder.append(str9);
      localStringBuilder.append("'");
      i = 1;
    }
    if (paramInt <= 0)
    {
      if ((this.a) && (commons.a))
      {
        if (i == 1)
          localStringBuilder.append(",");
        String str8 = UIDHelper.a(UIDHelper.getODIN1(UIDHelper.getAndroidId(localContext)), paramString3);
        localStringBuilder.append("O1:'");
        localStringBuilder.append(str8);
        localStringBuilder.append("'");
        i = 1;
      }
      if ((this.d) && (commons.d))
      {
        String str6 = UIDHelper.getFBId(localContext);
        if (str6 != null)
        {
          if (i == 1)
            localStringBuilder.append(",");
          String str7 = UIDHelper.a(str6, paramString3);
          localStringBuilder.append("FBA:'");
          localStringBuilder.append(str7);
          localStringBuilder.append("'");
          i = 1;
        }
      }
      if ((this.e) && (commons.e))
      {
        if (i == 1)
          localStringBuilder.append(",");
        String str5 = UIDHelper.a(UIDHelper.getUM5(UIDHelper.getAndroidId(localContext)), paramString3);
        localStringBuilder.append("UM5:'");
        localStringBuilder.append(str5);
        localStringBuilder.append("'");
      }
    }
    for (i = 1; ; i = 1)
    {
      do
      {
        localStringBuilder.append("}");
        if (i != 1)
          break;
        return UIDHelper.encryptRSA(localStringBuilder.toString());
        if (((paramInt & 0x2) != 2) && (this.a) && (commons.a))
        {
          if (i == 1)
            localStringBuilder.append(",");
          String str4 = UIDHelper.a(UIDHelper.getODIN1(UIDHelper.getAndroidId(localContext)), paramString3);
          localStringBuilder.append("O1:'");
          localStringBuilder.append(str4);
          localStringBuilder.append("'");
          i = 1;
        }
        if (((paramInt & 0x4) != 4) && (this.d) && (commons.d))
        {
          String str2 = UIDHelper.getFBId(localContext);
          if (str2 != null)
          {
            if (i == 1)
              localStringBuilder.append(",");
            String str3 = UIDHelper.a(str2, paramString3);
            localStringBuilder.append("FBA:'");
            localStringBuilder.append(str3);
            localStringBuilder.append("'");
            i = 1;
          }
        }
      }
      while (((paramInt & 0x8) == 8) || (!this.e) || (!commons.e));
      if (i == 1)
        localStringBuilder.append(",");
      String str1 = UIDHelper.a(UIDHelper.getUM5(UIDHelper.getAndroidId(localContext)), paramString3);
      localStringBuilder.append("UM5:'");
      localStringBuilder.append(str1);
      localStringBuilder.append("'");
    }
    return null;
  }

  public void setFromJSON(JSONObject paramJSONObject)
  {
    this.a = InternalSDKUtil.getBooleanFromJSON(paramJSONObject, "O1", this.a);
    this.b = InternalSDKUtil.getBooleanFromJSON(paramJSONObject, "SID", this.b);
    this.c = InternalSDKUtil.getBooleanFromJSON(paramJSONObject, "LID", this.c);
    this.d = InternalSDKUtil.getBooleanFromJSON(paramJSONObject, "FBA", this.d);
    this.e = InternalSDKUtil.getBooleanFromJSON(paramJSONObject, "UM5", this.e);
  }

  public JSONObject toJSON()
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    localJSONObject.put("O1", this.a);
    localJSONObject.put("SID", this.b);
    localJSONObject.put("LID", this.c);
    localJSONObject.put("FBA", this.d);
    localJSONObject.put("UM5", this.e);
    return localJSONObject;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.inmobi.commons.uid.UID
 * JD-Core Version:    0.6.2
 */